package cn.tedu.egmvc1.controller;

import cn.tedu.egmvc1.pojo.dto.InsDTO;
import cn.tedu.egmvc1.pojo.entity.Staff;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
public class StaffController {
    @RequestMapping("/emp/insert")
    @ResponseBody
    public String insert(InsDTO insDTO){
        insDTO.setName("张三");
        insDTO.setSalary(1000.0);
        insDTO.setJob("程序员");
        return "员工添加成功";
    }

    @RequestMapping("emp/select")
    @ResponseBody
    public String select(Staff staff){
        staff.getName();
        staff.getSalary();
        staff.getJob();
        staff.getId();
        System.out.println(staff);
        return "恭喜,查询成功";
    }

    @RequestMapping("emp/update")
    @ResponseBody
    private String update(Integer id,String name,Double salary,String job){
        id=1;
        name="lisi";
        salary=1000.0;
        job= "程序员";
        return "修改成功";
    }
    @RequestMapping("/emp/delete")
    @ResponseBody
    private String delete(Integer id){
        id=1;
        return "删除成功";
    }
}
